package java68_5;

import java.util.Scanner;

public class CustomerTest {
    public static void main(String[] args) {
        CustomerBiz biz=new CustomerBiz();
        biz.name="张经理";
        Scanner in=new Scanner(System.in);
        int ch=0;
        while(true){
            System.out.println("1:增加新客户\n2:查看\n3:查找\n4:改名字\n9:退出");
            ch=in.nextInt();
            if(ch==1){
                System.out.print("请输入新客户的姓名:");
                //String name=in.next();
                //biz.addNewCust(name);

                biz.addNewCust(in.next());
            }else if(ch==2){
                biz.showCust();
            }else if(ch==3){
                System.out.print("输入要查找的用户名:");
                String sname=in.next();
                boolean isIn=biz.search(sname);
                System.out.println(isIn?"这个人在":"不在!");
            }else if(ch==4){
                System.out.print("请输入要改的名字和他的新名字:");
                String oldName=in.next();
                String newName=in.next();
                boolean u=biz.update(oldName,newName);
                System.out.println(u?"修改成功":"老名字没找到");
            }
            else if(ch==9){
                break;
            }
        }
    }
}
